#ifndef SYSSERVERCLIENTSOCKET_H
#define SYSSERVERCLIENTSOCKET_H

#include "cnsMacroGlobal.h"
#include "framework.h"
#include "server-socket_global.h"
#include <QThread>
#include <uv.h>
#include "serverclientsocketproc.h"
#include "baseproto.h"

class SysServerClientSocket : public QObject
{
    Q_OBJECT
public:
    Q_INVOKABLE SysServerClientSocket();
    int client_initialize(ServerClientSocketProcPtr client, ServerSocketProcPtr server);
    static void client_destroy(struct ServerClientSocketProc* client);
    static void _on_disconnect(uv_handle_t* handle);
    static void _on_alloc_buffer(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf);
    static void _on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf);
    void client_read(struct ServerClientSocketProc* client);
    Q_INVOKABLE void f__on_disconnect(struct ServerClientSocketProc* client);
};

Q_DECLARE_METATYPE(SysServerClientSocket*)

#endif // SysServerClientSocket_H
